<!DOCTYPE html>
<!--[if IE 9 ]><html class="ie9"><![endif]-->
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
        <meta name="format-detection" content="telephone=no">
        <meta charset="UTF-8">

        <meta name="description" content="Violate Responsive Admin Template">
        <meta name="keywords" content="Super Admin, Admin, Template, Bootstrap">

        <title>覆冰点管理</title>
            
        <!-- CSS -->
        <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
        <link href="css/animate.min.css" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
        <link href="css/form.css" rel="stylesheet">
        <link href="css/calendar.css" rel="stylesheet">
        <link href="css/media-player.css" rel="stylesheet">
        <link href="css/style.css" rel="stylesheet">
        <link href="css/icons.css" rel="stylesheet">
        <link href="css/generics.css" rel="stylesheet"> 
        <link href="css/menu.css" rel="stylesheet">
        <!--<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/bootstrap-3.3.4.css">-->
    
        <style type="text/css">
        	#Ice td  #play2 th #play3 th{
        		display: inline-block;
        		height: 50px;
        		width: 120px;
        	}
        	#IceTable input{
        		color: black;
        		background-color: gainsboro;
        		border-radius: 5px;
        		font-family: "微软雅黑";
        		/*font-weight: bold;*/
        		opacity: 0.8;
        		border-color: forestgreen;
        		width: 90%;
        	}
        	#IceTable input:hover{
        		background-color: wheat;
        		cursor:pointer;
        	}
        	.ICEEdit:hover{
        		cursor:pointer;
        		color:orange;
        	}
        	.ICEDelete:hover{
        		cursor: pointer;
        		color: orange;
        	}
        	
        	#IceTable{
        		width: 720px;
        		height: 720px;
        		color: black;
        		margin: 10px;
        		/*background-image: url(img/guowan1.png);*/
        		background-position: center;
        		background-size: 720px 720px;
        	}
        	#EditICE{
				position: absolute;
				left: 38%;
				font-family:"微软雅黑" ;
				font-size: 25px;
				color: orange;
				border-radius:5px;
				
			}	
        </style>
    </head>
    <body id="skin-blur-blue">
        <header id="header" class="media">
            <a href="" id="menu-toggle"></a> 
            <a class="logo pull-left" href="asset_management.html">电力管理系统</a>
            
            <div class="media-body">
                <div class="media" id="top-menu">
                    <div class="pull-left tm-icon">
                        <a data-drawer="messages" class="drawer-toggle" href="">
                            <i class="sa-top-message"></i>
                            <i class="n-count animated"></i>
                            <span>实时消息</span>
                        </a>
                    </div>
                    <div class="pull-left tm-icon">
                        <a data-drawer="notifications" class="drawer-toggle" href="">
                            <i class="sa-top-updates"></i>
                            <i class="n-count animated"></i>
                            <span>告警信息</span>
                        </a>
                    </div>
                    
                    

                    <div id="time" class="pull-right">
                        <span id="hours"></span>
                        :
                        <span id="min"></span>
                        :
                        <span id="sec"></span>
                    </div>

                    <div class="media-body">
                        <input type="text" class="main-search">
                    </div>
                </div>
            </div>
        </header>
        
        
        
        
        
        <div class="clearfix"></div>
        
        <section id="main" class="p-relative" role="main">

            <!-- Sidebar -->
            <aside id="sidebar">

                <ul class="list-unstyled side-menu" style="width: 100%!important;padding-top: 20px;text-align: center;line-height: 40px;">
                    <!--<li>
                        <a href="operational_monitoring.html" id='menuurl'>
                            <i class="fa fa-calendar-o"></i><span> 运行监测</span>
                        </a>
                    </li>
                    <li>
                        <a  href="keyInfo.html"  id='menuurl'>
                            <i class="fa fa-bar-chart-o"></i><span> 文件上传</span>
                        </a>
                    </li>
                    <li>
                        <a href="mstp_map.html" id='menuurl'>
                            <i class="fa fa-bar-chart-o"></i><span> 全息图概览</span>
                        </a>
                    </li>-->
                    <li >
                        <a href="asset_management.html"  id='menuurl'>
                            <i class="fa fa-building-o"></i><span> 资产管理</span>
                        </a>
                    </li>
                    <li>
                        <a href="trajectory.html"  id='menuurl'>
                            <i class="fa fa-sort-amount-asc"></i><span> 历史轨迹</span>
                        </a>
                    </li>
                    <li>
                        <a href="Three_span_point.html" id='menuurl'>
                            <i class="fa fa-calendar-o"></i><span> 三跨点管理</span>
                        </a>
                    </li>
                    <li class="active">
                        <a href="ice.html"  id='menuurl'>
                            <i class="fa  fa-money"></i><span> 隐患点管理</span>
                        </a>
                    </li>
                    <li>
                        <a href="fire.html" id='menuurl'>
                            <i class="fa fa-calendar-o"></i><span> 山火点管理</span>
                        </a>
                    </li>
                    <!--<li>
                        <a href="deviceManager.html"  id='menuurl'>
                            <i class="fa fa-briefcase"></i><span> 设备管理</span>
                        </a>
                    </li>-->
                    
                    <li >
                        <a href="userMng.html" id='menuurl'>
                            <i class="fa fa-users"></i><span> 用户管理</span>
                        </a>
                    </li>
                    <li>
                        <a href="fileupdata.html" id='menuurl'>
                            <i class="fa fa-cogs"></i><span > 文件管理</span>
                        </a>
                    </li>
                </ul>
                

            </aside>
        
            <!-- Content -->
            <section id="content" class="container">
                <!-- Messages Drawer -->
               
               

                 <!--Breadcrumb--> 
                <ol class="breadcrumb hidden-xs">
                    <li><a href="index.html">主页</a></li>
                    <li><a href="#">管理</a></li>
                    <li class="active">隐患点管理</li>
                </ol>
                
                <h4 class="page-title">隐患点</h4>
               
				<div class="block-area" id="defaultStyle" style="display: inline-block;">
					<div class="row" >
						<div class="col-md-12" style="display: inline-block;">
							<div class="tile" style="width:100%;">
								<h2 class="tile-title">隐患点管理</h2>
								<table class="table tile" id="Ice">
									<thead>
										<tr id="play2">
											<!--<th>姓名</th>-->
											<th>线路名称</th>
											<th>一级单位</th>
											<th>二级单位</th>
											<th>电压等级</th>
											<th>投运年月</th>
											<th style="width: 100px;!important">易覆冰区段</th>
											<th >覆冰年份</th>
											<th>杆号</th>
											<th>海拔高度（米）</th>
											<th>已安装杆号</th>
											<th>设备状态</th>
											<!--<th>2016年计划安装杆号</th>-->
											<!--<th>模拟导线安装杆号</th>
											<th>模拟导线计划安装杆号</th>-->
											<th>备注</th>
											<th>修改</th>
											<!--<th>原导线型号</th>
											<th>模拟导线型</th>-->
											<th>删除</th>
											
											<!--<th>创建时间</th>-->
										</tr>
									</thead>
									<tbody id="ice">
										
									</tbody>
								</table>
								
				
							</div>
						</div>
				
					
					
					
						
					</div>
				</div>                    
                   
                   
                
   
            </section>
            
            <br/><br/>
        </section>
        
        <!-- Javascript Libraries -->
        <!-- jQuery -->
         <script src="js/jquery-3.2.1.js"></script> <!-- jQuery Library -->
         <script src="js/bootstrap.js"></script>
        <script src="js/jquery.dataTables.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="js/jquery.dataTables.bootstrap.js" type="text/javascript" charset="utf-8"></script>
        <!--Media Player-->
        <script src="js/media-player.min.js"></script> <!-- USA Map for jVectorMap -->
        <!-- UX -->
        <script src="js/scroll.min.js"></script> <!-- Custom Scrollbar -->
        
        <!-- Other -->
        <script src="js/calendar.min.js"></script> <!-- Calendar -->
        
         <script src="js/Tabullet.js"></script>
         <script src="layer-v3.1.0/layer/layer.js" type="text/javascript" charset="utf-8"></script>
        <!-- All JS functions -->
        <!--<script src="js/functions.js"></script>-->
        <script src="js/Tabullet.js" type="text/javascript" charset="utf-8"></script>
    	<script src="js/urlConfig.js" type="text/javascript" charset="utf-8"></script>
        
       <script type="text/javascript">
       	
//     	var url ='http://117.27.139.39:4322/'
       	$.ajax({
//				url: 'http://192.168.1.41:1337/iceLineInfo',
				url: url + 'iceLineInfo', //url: url + 'linePoles/' + 504,
				//data: "127605d5-ee91-4557-a7fe-fb096918b6bc",
				type: 'get',
				dataType: 'json',
				success: function(data) {
//					console.log('获取隐患点信息成功');
//					console.log(data.data)
//		        	console.log(data.data.name)
					var js = JSON.parse(data.data);
					console.log(js.length);
					console.log(js)
					var trend = '';
					for(var i = 0; i < js.length; i++) {
						var Distance = js[i].distance * 1
						var js = JSON.parse(data.data);
						var ICE=js[i]
						
						trend += '<tr>'
			            trend += '<td>' + ICE.lineName +  '  </td>'
						trend += '<td>' + ICE.oneLevelUnit +  '  </td>'
						trend += '<td>' + ICE.twoLevelUnit +  '  </td>'
						trend += '<td>' + ICE.voltageClass +  '  </td>'
						trend += '<td>' + ICE.startTime + '</td>'
						trend += '<td>' + ICE.coverIcePoles +  '  </td>'
						trend += '<td>' + ICE.coverYear +  '  </td>'
						trend += '<td>' + ICE.poleOrd +  '  </td>'
						trend += '<td>' + ICE.hight+  '  </td>'
						trend += '<td>' + ICE.monitorPoleOrd +  '  </td>'
						trend += '<td>' + ICE.deviceStatus +  '  </td>'
//						trend += '<td>' + ICE.installPlanPoleOrd + '</td>'
//						trend += '<td>' + ICE.installPlanYear + '</td>'
//						trend += '<td>' + ICE.simulateWirePoleOrd + '</td>'
						trend += '<td>' + ICE.ect +' </td>'
						trend += '<td class="ICEEdit" id="'+ICE.id+"_____"+'">修改</td>'
						trend += '<td class="ICEDelete" id="'+ICE.id+'">删除</td>'
//						trend += '<td>' + ICE.oldWireModel + '</td>'
//						trend += '<td>' + ICE.simulateWireModel + '</td>'
						trend += '</tr>' 
						
					}
					$('#ice').html(trend);
					form_paging();
					
				$(document.body).on('click',".ICEEdit",function(event){
//				var FIRES = $(".ICEEdit").index($(this));
				var ice_id=$(this).attr("id").replace('_____', '');
				var parent1 = window.parent.document.getElementById(''+ice_id+'').parentNode;
				var ice_lineName=parent1.children[0].textContent;
				var ice_oneLevelUnit=parent1.children[1].textContent;
				var ice_twoLevelUnit=parent1.children[2].textContent;
				var ice_voltageClass=parent1.children[3].textContent;
				var ice_startTime=parent1.children[4].textContent;
				var ice_coverIcePoles=parent1.children[5].textContent;
				var ice_coverYear=parent1.children[6].textContent;
				var ice_poleOrd=parent1.children[7].textContent;
				var ice_hight=parent1.children[8].textContent;
				var ice_monitorPoleOrd=parent1.children[9].textContent;
				var ice_deviceStatus=parent1.children[10].textContent;
				var ice_ect=parent1.children[11].textContent;
//				var ice_=$(this).attr("");
				console.log(ice_lineName)
			
//				var F=js[FIRES];
				layer.open({
							type: 1,
							area: ['720px', '720px'],
							shadeClose: true, //点击遮罩关闭
							content: '<div id="IceTable">' +
								'<div class="container">' +
								'<div class="poleShow">' +
								'<button type="submit" id="EditICE">修改覆冰点信息</button><br>' +
								'<label for="">覆冰线路名称：</label><input type="text"  id="TZ1" placeholder="可修改" value=' + ice_lineName + ' />' +
								'<label for="">维护一级单位： </label><input type="text" id="TZ2" placeholder="可修改" value=' + ice_oneLevelUnit+ ' />' +
								'<label for="">维护二级单位： </label><input type="text" id="TZ3" placeholder="可修改" value=' + ice_twoLevelUnit+ ' />' +
								'<label for="">线路电压等级： </label><input type="text" id="TZ4" placeholder="可修改" value=' + ice_voltageClass+ ' />' +
								'<label for="">线路投运年月： </label><input type="text"  id="TZ5" placeholder="可修改" value=' + ice_startTime+ ' />' +
								'<label for="">易覆冰区段：</label><input type="text"  id="TZ6" placeholder="可修改" value=' + ice_coverIcePoles+ ' />' +
								'<label for="">历史覆冰年份：</label><input type="text"  id="TZ7" placeholder="可修改" value=' + ice_coverYear+ ' />' +
								'<label for="">覆冰杆塔编号：</label><input type="text"  id="TZ8" placeholder="可修改" value=' + ice_poleOrd+ ' />' +
								'<label for="">海拔高度（米）：</label><input type="text"  id="TZ9" placeholder="可修改" value=' + ice_hight+ ' />' +
								'<label for="">已安装杆号：</label><input type="text"  id="TZ10" placeholder="可修改" value=' + ice_monitorPoleOrd+ ' />' +
								'<label for="">设备的状态：</label><input type="text"  id="TZ11" placeholder="可修改" value=' + ice_deviceStatus+ ' />' +
								'<label for="">备注（特殊情况）：</label><input type="text"  id="TZ12" placeholder="可修改" value=' + ice_ect+ ' />' +
								'<label for="">ID(切勿修改)：</label><input type="text"  id="TZ13" placeholder="可修改" value=' + ice_id + ' />' +
								'</div>' +
								'</div>' +
								'</div>'
						});
								
					});
					
					console.log("66666666666666666666666666666")
					// 阻止表单的默认提交事件
					
				//	发送数据到后端
				
				$(document.body).on('click',"#EditICE",function(event){
					
				
					console.log("rrrrrrrrrr")
					 $.ajax({
				        type: "put",
				        url:url+'iceLine',
				        dataType: 'json',
				        data: {
				      	"id": $("#TZ13").val(),
						"lineName":$("#TZ1").val(),
						"oneLevelUnit":$("#TZ2").val(),
						"twoLevelUnit":$("#TZ3").val(),
						"voltageClass":$("#TZ4").val(),
						"startTime":$("#TZ5").val(),
						"coverIcePoles":$("#TZ6").val(),
						"coverYear":$("#TZ7").val(),
						"poleOrd":$("#TZ8").val(),
						"hight":$("#TZ9").val(),
						"monitorPoleOrd":$("#TZ10").val(),
						"deviceStatus":$("#TZ11").val(),
						"ect":$("#TZ12").val()
					
			            
						
				},
				        success: function (data, status) { 
				        	console.log("data："+data)
				        	console.log("状态码："+status)
				        	console.log("data.message："+data.message)
				        	
				        	if(data.errorCode == 1){
				        		layer.msg("修改覆冰点数据成功!");
				        		
										
								setTimeout( function(){
							    layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
							    
								}, 2000);//延迟1500毫米
								layer.closeAll('loading'); //关闭加载层
				        		setTimeout( function(){
								    
//									layer.closeAll('loading'); //关闭加载层	
								    parent.location.reload()
								}, 3000);//延迟1500毫米
				        	}
				        	
				        }
				    });
				  
				 });
					
				}//获取路线结束
			});//ajax结束
			
			$(document.body).on('click',".ICEDelete",function(){
					var result=confirm('你确定要删除么？')
					
					console.log(this.id)
					if(result){
						
//							console.log($(this.parent))
							$.ajax({
					        type: "delete",
					        url:url+'iceLine',
					        dataType: 'json',
					        data: {
						    	"id": this.id
						    	
							},
					        success: function (data, status) { 
					        	
					        	if(data.errorCode == 1){
				        		layer.msg(data.message);
				        		
										
								setTimeout( function(){
							    layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
							    
								}, 2000);//延迟1500毫米
								layer.closeAll('loading'); //关闭加载层
				        		setTimeout( function(){
								    
//									layer.closeAll('loading'); //关闭加载层	
								    parent.location.reload()
								}, 3000);//延迟1500毫米
				        	}
					        	
					    		}
							})
					}
				})
			
			
			
			
			
						
						
			
			
			function form_paging() {
				var table = $('#Ice').dataTable({
				"aaSorting": [], //默认第几个排序
				"bStateSave": false, //状态保存
				"bFilter": true,
				"aoColumnDefs": [
					//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
					{
						"orderable": false,
						"aTargets": [0, 1, 2]
					} // 制定列不参与排序
					]
				});
			
				}
       </script>
    </body>
</html>

